<?php
require '../../../loader.php';
require 'common.php';

if (isset($_POST['type'])) {
    $type = $_POST['type'];
}else{
    error('参数错误');
}

if ($type != 'database' &&  $type!='cache'){
    error('参数错误');
}

$fileList = scandir(ROOT.DS.CUBOX.DS.$type);

$list = [];

for($i=0;$i<count($fileList);$i++){
    if(strpos($fileList[$i], '.php') !== false){
        $className = str_replace('.php', '', $fileList[$i]);
        $class = '\\bibi\\'.$type.'\\'.$className;
        $list[$className] = $class::configParams();
    }
}

//获取当前数据库配置
success($list);
exit;